Skip to main content

Size Class

Description:

  A class for creating Size objects.

__call

Type: Metamethod.

Description:

  Create a new Size object with the given width and height.

Signature:

metamethod __call: function(
self: SizeClass,
width?: number --[[0]],
height?: number --[[0]]
): Size

Usage:

local size = Size(10, 20)

Parameters:

ParameterTypeDescription
widthnumber[optional] The width of the new size (default 0).
heightnumber[optional] The height of the new size (default 0).

Returns:

Return TypeDescription
SizeThe new Size object.

__call

Type: Metamethod.

Description:

  Create a new Size object from an existing Size object.

Signature:

metamethod __call: function(self: SizeClass, other: Size): Size

Usage:

local newSize = Size(existingSize)

Parameters:

ParameterTypeDescription
otherSizeThe existing Size object to create the new object from.

Returns:

Return TypeDescription
SizeThe new Size object.

__call

Type: Metamethod.

Description:

  Create a new Size object from a Vec2 object.

Signature:

metamethod __call: function(self: SizeClass, vec: Vec2): Size

Usage:

local size = Size(Vec2(10, 20))

Parameters:

ParameterTypeDescription
vecVec2The vector to create the new size from, represented by a Vec2 object.

Returns:

Return TypeDescription
SizeThe new Size object.

zero

Type: Readonly Field.

Description:

  Gets zero-size object.

Signature:

const zero: Size